Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b7c9680

Browse files
committedOct 13, 2014
1. Add some implementation notes dealing with natural language values
and verb blank nodes 2. Fix Pat Cappelaere's name in the acknowledgements per his request 3. Adding W3C basic geo and geosparql to initial context
1 parent 7521c2a commit b7c9680

File tree

2 files changed

+107
-3
lines changed

2 files changed

+107
-3
lines changed
 

‎activitystreams2-context.jsonld

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"vcard": "http://www.w3.org/2006/vcard/ns#",
88
"org": "http://www.w3.org/ns/org#",
99
"prov": "http://www.w3.org/ns/prov#",
10-
"geo": "http://ld.geojson.org/vocab#",
10+
"geo": "http://www.w3.org/2003/01/geo/wgs84_pos#",
11+
"geos": "http://www.opengis.net/ont/geosparql#",
1112
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
1213
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
1314
"owl": "http://www.w3.org/2002/07/owl#",

‎activitystreams2.html

+105-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ <h2>Basic activity with some additional detail</h2>
258258
},
259259
"object" : {
260260
"@type": "urn:example:types:article",
261-
"@id": "urn:example:blog:abc123/xyz"
261+
"@id": "urn:example:blog:abc123/xyz",
262262
"url": "http://example.org/blog/2011/02/entry",
263263
"displayName": "Why I love Activity Streams"
264264
},
@@ -478,6 +478,78 @@ <h2><dfn title="NaturalLanguageValue">Natural Language Values</dfn></h2>
478478
The associated values MUST be Strings.
479479
</p>
480480

481+
<section class="informative">
482+
<h2>Implementation Note</h2>
483+
484+
<p>
485+
Implementers ought to note that, in [[JSON-LD]], establishment of a default
486+
language requires the use of the <code>@language</code> keyword inside the
487+
JSON-LD <code>@context</code>. For instance:
488+
</p>
489+
490+
<figure>
491+
<figcaption>Using the <code>@language</code> keyword:</figcaption>
492+
<pre class="example highlight json">{
493+
"@context": {
494+
"@language": "en"
495+
},
496+
"displayName": "This is the title"
497+
}</pre></figure>
498+
499+
<p>Using the <code>@language</code> keyword in this manner establishes the
500+
default language context for all string literal property values contained
501+
by the object, including those that may not be intended as natural language
502+
values. This current definition for <code>@language</code> makes it difficult
503+
for implementations that choose to ignore JSON-LD semantics when processing
504+
Activity Streams documents or that wish to limit the language context only to
505+
properties that are truly intended as natural language values. The <code>language</code>
506+
property introduced by the Activity Streams Vocabulary is provided to address
507+
these shortcomings by allowing a default language to be established independently
508+
of the JSON-LD <code>@context</code>.</p>
509+
510+
<figure>
511+
<figcaption>Using the <code>language</code> property has the same effect
512+
as using the <code>@language</code> inside the JSON-LD <code>@context</code>:</figcaption>
513+
<pre class="example highlight json">{
514+
"language": "en",
515+
"displayName": "This is the title"
516+
}</pre></figure>
517+
518+
<p>However, use of <code>language</code>
519+
means that JSON-LD based implementations will need to take an additional
520+
processing step to ensure that properties such as <code>title</code>, <code>displayName</code>,
521+
<code>summary</code> and <code>content</code> are handled properly.
522+
523+
<figure>
524+
<figcaption>For instance, the following example JavaScript function extracts
525+
the value of the <code>language</code> property and injects it as an appropriate
526+
JSON-LD <code>@language</code> keyword into specific properties that are defined
527+
as Natural Language Values to ensure that such properties are properly handled
528+
by the standardized JSON-LD algorithms:</figcaption>
529+
<pre class="example highlight javascript">
530+
function _fixdefaultlanguage(lang, obj) {
531+
var __lang = obj['language'] || lang;
532+
for (var n in obj) {
533+
if (nlvs.indexOf(n) > -1) {
534+
var vals = obj[n];
535+
vals.forEach(function(val) {
536+
val['@language'] = val['@language'] || __lang;
537+
});
538+
} else if (typeof obj[n] === 'object') {
539+
var next = exp[n];
540+
if (!Array.isArray(next))
541+
next = [next];
542+
next.forEach(
543+
_fixdefaultlanguage.bind(
544+
null,__lang));
545+
}
546+
}
547+
}
548+
</pre>
549+
</figure>
550+
551+
</section>
552+
481553
</section>
482554

483555
<section id="link">
@@ -695,6 +767,27 @@ <h2><dfn title="Activity" id="activity">Activity</dfn></h2>
695767
}
696768
</code></pre></figure>
697769

770+
<section class="informative">
771+
<h2>Implementation Note</h2>
772+
773+
<p>
774+
Since Activity Streams 1.0, the <code>verb</code> property has
775+
been defined to permit identifiers either in the form of absolute IRI's
776+
or simple <code>isegment-nz-nc</code> tokens. For instance,
777+
"<code>post</code>" is a valid Activity Streams verb.
778+
</p>
779+
780+
<p>
781+
However, existing JSON-LD processing algorithms have difficulty
782+
processing such <code>isegment-nz-nc</code> token values properly
783+
without additional processing. It is RECOMMENDED that JSON-LD
784+
implementations handle simple <code>isegment-nz-nc</code> verbs
785+
as "blank nodes". For instance, the value "<code>post</code>" would
786+
map to the blank node identified as <code>_:post</code>.
787+
</p>
788+
789+
</section>
790+
698791
<section id="audienceTargeting">
699792

700793
<h2>Audience Targeting</h2>
@@ -887,6 +980,8 @@ <h2>Verbs and Object Types</h2>
887980

888981
<h2><dfn>Potential Actions</dfn></h2>
889982

983+
<p><mark>Ed.Note: This section is currently provisional and may be moved to a separate document.</mark></p>
984+
890985
<p>
891986
All <code>Object</code> instances can have an
892987
<code><a href="activitystreams2-vocabulary.html#dfn-action">action</a></code> property
@@ -1108,6 +1203,14 @@ <h2>Handling of JSON-ID Compact IRIs</h2>
11081203
<td><code>prov:</code></td>
11091204
<td><code>http://www.w3.org/ns/prov#</code></td>
11101205
</tr>
1206+
<tr>
1207+
<td><code>geo:</code></td>
1208+
<td><code>http://www.w3.org/2003/01/geo/wgs84_pos#</code></td>
1209+
</tr>
1210+
<tr>
1211+
<td><code>geos:</code></td>
1212+
<td><code>http://www.opengis.net/ont/geosparql#</code></td>
1213+
</tr>
11111214
</table>
11121215

11131216
<p>
@@ -1264,7 +1367,7 @@ <h2>Acknowledgements</h2>
12641367
Chan, Michael Richardson, Michael Sullivan, Mike Macgirvin, Mislav
12651368
Marohni&#263;, Mo Jangda, Monica Wilkinson, Nate Benes, NeilFred
12661369
Picciotto, Nick Howard, Nick Lothian, Nissan Dookeran, Nitya
1267-
Narasimhan, Pablo Martin, Padraic Brady, Pat G. Cappalaere, Patrick
1370+
Narasimhan, Pablo Martin, Padraic Brady, Pat Cappelaere, Patrick
12681371
Aljord, Peter Ferne, Peter Reiser, Peter Saint-Andre, Phil Wolff,
12691372
Philip (flip) Kromer, Richard Cunningham, Richard Zhao, Rick
12701373
Severson, Robert Hall, Robert Langbert, Robert Dolin, Robin Cover,

0 commit comments

Comments
 (0)
Please sign in to comment.